﻿#region Copyright
//       Copyright (c) 2009 - Antoine Jaussoin - http://www.jaussoin.com/blog/
// 
//        This program is free software: you can redistribute it and/or modify
//        it under the terms of the GNU General Public License as published by
//        the Free Software Foundation, either version 3 of the License, or
//        (at your option) any later version.
// 
//        This program is distributed in the hope that it will be useful,
//        but WITHOUT ANY WARRANTY; without even the implied warranty of
//        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//        GNU General Public License for more details.
// 
//        You should have received a copy of the GNU General Public License
//        along with this program.  If not, see <http://www.gnu.org/licenses/>.
#endregion
using System;

namespace FT.Architecture.Utils.Serialisation
{
    /// <summary>
    /// Encode and decode things in Base 64
    /// </summary>
    public class Base64
    {
        /// <summary>
        /// Convert an array of bytes into a Base 64 string
        /// </summary>
        /// <param name="bytes"></param>
        /// <returns></returns>
        public static string FromBytes(byte[] bytes)
        {
            return Convert.ToBase64String(bytes);
        }

        /// <summary>
        /// Converts a base 64-encoded string into an array of bytes
        /// </summary>
        /// <param name="base64String"></param>
        /// <returns></returns>
        public static byte[] ToBytes(string base64String)
        {
            return Convert.FromBase64String(base64String);
        }
    }
}
